#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 19-6-20 下午11:27
# @Author  : Tom
# @Site    : 
# @File    : urls.py
# @Software: PyCharm

from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from meiduo_admin.views import category
from meiduo_admin.views import SkuImage
from meiduo_admin.views import permission
from .views import increment_view, users
from rest_framework.routers import DefaultRouter
from .views import skus, goods, specs, orders, brands

urlpatterns = [
    # --------------------------1.首页：用户数量统计---------------------------
    url(r'^authorizations/$', obtain_jwt_token),
    # 获取用户总量
    url(r'^statistical/total_count/$', increment_view.IncrementCountView.as_view()),
    # 获取日访问次数
    url(r'^statistical/day_increment/$', increment_view.IncrementDayCountView.as_view()),
    # 获取日活跃量
    url(r'^statistical/day_active/$', increment_view.IncrementDayActiveView.as_view()),
    # 获取日下单量
    url(r'^statistical/day_orders/$', increment_view.IncrementDayOrderView.as_view()),
    # 上个月日均访问量
    url(r'^statistical/month_increment/$', increment_view.UserMonthCountView.as_view()),
    # 获取当天访问量
    url(r'^statistical/goods_day_views/$', increment_view.GoodsDayCountView.as_view()),

    # --------------------------2.用户管理---------------------------
    url(r'^users/$', users.UserView.as_view()),

    # --------------------------3.商品管理---------------------------
    # 1.sku管理
    # 获取商品的三级分类
    url(r'^skus/categories/$', skus.SkuView.as_view({"get": "Category"})),
    # 获取商品的spu
    url(r'^goods/simple/$', skus.SkuView.as_view({"get": "GoodsSimple"})),
    # 获取商品的规格选项表
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SkuView.as_view({"get": "goodsspecoption"})),

    # 2.spu管理
    # 增加spu 品牌分类
    url(r'^goods/brands/simple/$', goods.GoodsView.as_view({"get": "get_brand"})),
    # 增加spu 获取一类分类信息
    url(r'^goods/channel/categories/$', goods.GoodsView.as_view({"get": "get_category"})),
    # 增加spu 获取二类和三类 分类信息
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', goods.GoodsView.as_view({"get": "get_categorys"})),

    # --------------------------spu商品管理---------------------------
    # 商品规格表
    url(r'^goods/specs/simple/$', specs.SpecOptionView.as_view({"get": "specsView"})),

    # --------------------------order商品管理---------------------------
    # 商品规格表
    url(r'^orders/(?P<pk>\d+)/status/$', orders.OrderView.as_view({"put": "ordersstatus"})),

    # --------------------------分类管理---------------------------
    # 订单查询
    url(r'^goods/channel_types/$', category.GoodsChannelView.as_view({"get": "CategoryTypeView"})),
    # 查询详细订单
    url(r'^goods/categories/$', category.GoodsChannelView.as_view({"get": "categoriesView"})),

    # --------------------------sku商品图片管理---------------------------
    # 商品图片管理
    url(r'^skus/simple/$', SkuImage.SKUImageView.as_view({"get": "SKUImagesView"})),

    # --------------------------4.系统管理---------------------------
    #
    url(r'^permission/content_types/$', permission.PermissionPers.as_view({"get": "content_types"})),

    url(r'^permission/simple/$', permission.PermissionGroup.as_view({"get": "permissionsimple"})),

    url(r'^permission/groups/simple/$', permission.PermissionAdmins.as_view({"get": "permissiongroupsimple"})),

]

# --------------------------商品管理---------------------------
# --------------------------sku商品图片管理---------------------------
route = DefaultRouter()
route.register("skus/images", SkuImage.SKUImageView)
urlpatterns += route.urls

# --------------------------sku商品管理---------------------------
route = DefaultRouter()
route.register("skus", skus.SkuView)
urlpatterns += route.urls

# --------------------------商品规格选项管理---------------------------
route = DefaultRouter()
route.register("specs/options", specs.SpecOptionView)
urlpatterns += route.urls

# --------------------------商品规格管理---------------------------
route = DefaultRouter()
route.register("goods/specs", specs.SpecsView)
urlpatterns += route.urls

# --------------------------商品频道管理---------------------------
route = DefaultRouter()
route.register("goods/channels", category.GoodsChannelView)
urlpatterns += route.urls

# --------------------------商品品牌管理---------------------------
route = DefaultRouter()
route.register("goods/brands", brands.GoodsBrandsView)
urlpatterns += route.urls

# --------------------------spu商品管理---------------------------
route = DefaultRouter()
route.register("goods", goods.GoodsView)
urlpatterns += route.urls

# --------------------------订单管理---------------------------
route = DefaultRouter()
route.register("orders", orders.OrderView)
urlpatterns += route.urls

# --------------------------系统管理---------------------------
# 权限
route = DefaultRouter()
route.register("permission/perms", permission.PermissionPers)
urlpatterns += route.urls
# 用户组
route = DefaultRouter()
route.register("permission/groups", permission.PermissionGroup)
urlpatterns += route.urls
# 管理员
route = DefaultRouter()
route.register("permission/admins", permission.PermissionAdmins)
urlpatterns += route.urls
print(urlpatterns)
